<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class SetMeal extends Model
{
    use HasFactory;

    protected $table = 'sp_set_meal';
    protected $primaryKey = 'id';
    public $timestamps = false;

    //type类型  1 合同  2短信
    const SET_MEAL_TYPE_CONTRACT = 1;//合同
    const SET_MEAL_TYPE_MSG = 2;//短信

    //status状态  0禁用  1正常
    const SET_MEAL_STATUS_ENABLE = 1;//启用
    const SET_MEAL_STATUS_DISABLE = 0;//禁用


    protected function GetSetMeal($where)
    {
        $data = $this->select('id','number','amount')
            ->where($where)
            ->get();
        $data = $data ? $data->toArray() : array();
        return $data;
    }

    protected function GetOneSetMeal($where)
    {
        $data = $this
            ->where($where)
            ->first();
        $data = $data ? $data->toArray() : array();
        return $data;
    }


}
